package com.springCloud.feign.service;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Title: HelloServiceFallbackFactory<br>
 * Description: HelloServiceFallbackFactory<br>
 * CreateDate:2021年02月08日 15:57
 *
 * @author jackie.scl
 */
@Component
public class HelloServiceFallbackFactory implements FallbackFactory<HelloService> {

    /**
     * Title: 异常回调处理<br>
     * Description: create<br>
     * CreateDate: 2021/2/8 21:07<br>
     *
     * @category 异常回调处理
     * @author jackie.scl
     * @param throwable
     * @return com.springCloud.feign.service.HelloService
     * @exception Exception
     */
    @Override
    public HelloService create(Throwable throwable) {
        System.out.println("Fallback reason:" + throwable.getMessage());
        return new HelloService() {
            @Override
            public String sayHello(String exampler) {
                return "FallBack sayHello:" + exampler;
            }
        };
    }
}
